#define _CRT_SECURE_NO_WARNINGS 1
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define endl '\n'

int main() {
	ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);
	string s;
	ll n;
	cin >> s >> n;
	ll len1 = s.size(), len2 = s.size();	
	while (len2 < n) len2 *= 2;
	while (n > len1) {
		ll k = len2 / 2 + 1;
		if (n >= k) {
			if (n == k) n--;
			else n -= k;
		}
		len2 /= 2;
	}
	cout << s[n - 1] << endl;
	return 0;
}